#coding=utf-8
from stockdb.misc import *

date = '2008-03-14'
codes = ['600601', '600050']
         
money = 10000
         
def get_position(td):
    return int( money * 0.01 / td.N)    

for c in codes:
    s = find_stock(c)
    td = s.find_td(date)
    
    p = get_position(td)
    print s.code, s.name, td.close, '%.2f%%'%td.price.change, '%.2f%%'%td.price.trade_rate, s.ts/10000
    print '\t', '%.2f'%td.N, '\t', '%.2f%%'%(td.N*100/td.close), '\t', p
